﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Orange.DesignPattern
{
    public abstract class Product
    {
        public abstract String Name();
    }

    public class SimpleFactory
    {

        //[global::System.Serializable]
        public class MyException : Exception
        {
            public MyException() { }
            public MyException(string message) : base(message) { }
            public MyException(string message, Exception inner) : base(message, inner) { }
            //protected MyException(
            //  global::System.Runtime.Serialization.SerializationInfo info,
            //  System.Runtime.Serialization.StreamingContext context)
            //    : base(info, context) { }
        }

        //

        public static Product CreateProduct(String name)
        {
            if (name == "Food")
            {
                return new Food();
            }
            return null;
            //throw new 
        }
    }
}
